﻿#if NETSTANDARD2_0 
using Microsoft.Extensions.DependencyInjection;
#endif

#if NET35
using Kernelx.Common.DependencyInjection;
#endif

using System;


namespace Kernelx.Contexts.Configuration
{
    using ClientImpls;
    using Core;


    partial class ClientWorkloadContextOptions
    {

        #region 静态操作

        /// <summary>
        /// 
        /// </summary>
        /// <param name="currentUser"></param>
        public static void SetCurrentUser(ICurrentUser currentUser) => ClientWorkloadContext.CurrentUser = currentUser;
        /// <summary>
        /// 在项目入口处配置并构建<see cref="IStartupWorkloadContext"/>实例
        /// </summary>
        /// <param name="services"></param>
        /// <param name="action"></param>
        public static void UseWorkloadStartupContext(IServiceCollection services, Action<ClientWorkloadContextOptions> action)
            => new ClientWorkloadContextOptions(services).UseWorkloadStartupContext(action);

        /// <summary>
        ///  在项目入口处配置并构建<see cref="IStartupWorkloadContext"/>实例
        /// </summary>
        /// <param name="action"></param>
        public static void UseWorkloadStartupContext(Action<ClientWorkloadContextOptions> action)
           => new ClientWorkloadContextOptions(new ServiceCollection()).UseWorkloadStartupContext(action);

        #endregion


    }
}

